package com.huawei.appmarket.support.audio.notification;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.huawei.appmarket.support.audio.AudioBean;
import com.huawei.secure.android.common.intent.SafeIntent;
import o.doo;
import o.epe;
import o.epn;

public class AudioNotificationReceiver extends BroadcastReceiver {
    public static final int EVENT_CLOSE = 4;
    public static final int EVENT_DEFAULT = 0;
    public static final String EVENT_KEY = "operation";
    public static final int EVENT_NEXT = 3;
    public static final int EVENT_PLAY = 1;
    public static final int EVENT_PREV = 2;
    public static final int EVENT_SWIPE = 5;

    public void onReceive(Context context, Intent intent) {
        switch (new SafeIntent(intent).getIntExtra(EVENT_KEY, 0)) {
            case 1:
                AudioBean ॱ = epe.ˏ().ॱ();
                if (ॱ == null || ॱ.ˋॱ()) {
                    epe.ˏ().ˊ(4);
                    return;
                }
                ˏ(context);
                ॱ.ˊ(0);
                ˋ();
                epe.ˏ().ͺ();
                epe.ˏ().ˊ(ॱ);
                return;
            case 2:
                ˏ(context);
                ˋ();
                epe.ˏ().ˏ(3);
                return;
            case 3:
                ˏ(context);
                ˋ();
                epe.ˏ().ˋ(2);
                return;
            case 4:
                epe.ˏ().ʽ(5);
                epe.ˏ().ˊ();
                return;
            case 5:
                epn.ˎ().ˎ(epe.ˏ().ॱ());
                return;
            default:
                return;
        }
    }

    private void ˏ(Context context) {
        if (!doo.ˊ(context) || doo.ͺ(context)) {
            context.sendBroadcast(new Intent("android.intent.action.CLOSE_SYSTEM_DIALOGS"));
        }
    }

    private void ˋ() {
        if (!epe.ˏ().ʻ()) {
            epe.ˏ().ˋ(System.currentTimeMillis());
        }
    }
}
